package com.xbongbong.paas.model.impl;

import com.xbongbong.paas.model.CustomButtonActionModel;
import com.xbongbong.paas.toolbox.exception.XbbException;
import com.xbongbong.paas.toolbox.util.DateTimeUtil;
import com.xbongbong.pro.domain.dao.CustomButtonActionDao;
import com.xbongbong.pro.domain.entity.CustomButtonActionEntity;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * @author 吴峰
 * @date 2021/03/03 16:28
 */
@Service("customButtonActionModel")
public class CustomButtonActionModelImpl implements CustomButtonActionModel {
    @Resource
    private CustomButtonActionDao customButtonActionDao;

    @Override
    public Integer insert(CustomButtonActionEntity entity) throws XbbException {
        Long now = DateTimeUtil.getInt();
        entity.setAddTime(now);
        entity.setUpdateTime(now);
        return customButtonActionDao.insert(entity);
    }

    @Override
    public Integer update(CustomButtonActionEntity entity) throws XbbException {
        Long now = DateTimeUtil.getInt();
        entity.setUpdateTime(now);
        return customButtonActionDao.update(entity);
    }

    @Override
    public List<CustomButtonActionEntity> findEntitys(Map<String, Object> param) {
        return customButtonActionDao.findEntitys(param);
    }

    @Override
    public Integer getEntitysCount(Map<String, Object> param) {
        return customButtonActionDao.getEntitysCount(param);
    }

    @Override
    public List findEntitysWithoutSub(Map<String, Object> param) {
        return null;
    }

    @Override
    public Integer insertBatch(List<CustomButtonActionEntity> addList) {
        return customButtonActionDao.insertBatch(addList);
    }

    @Override
    public Integer deleteBatch(List<Long> list, String corpid) {
        return customButtonActionDao.deleteBatch(list, corpid);
    }

    @Override
    public Integer updateBatch(List<CustomButtonActionEntity> updateList,  String corpid) {
        return customButtonActionDao.updateBatch(updateList, corpid);
    }

    @Override
    public Integer deleteFormId(Long formId, String corpid, Integer businessType) {
        return customButtonActionDao.deleteByFormId(formId, corpid, businessType);
    }
}
